// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import './app.css'
import { sync } from 'vuex-router-sync'

const FastClick = require('fastclick')
FastClick.attach(document.body)

Vue.config.productionTip = false

import AjaxPlugin from './components/AjaxPlugin/AjaxPlugin'

Vue.use(AjaxPlugin)

sync(store, router)

if (window.IS_MOBILE) {
  import('./h5.css').then(init)
} else {
  import('./pc.css').then(init)
}

function init() {
  /* eslint-disable no-new */
  new Vue({
    el: '#app',
    store,
    router,
    template: '<App/>',
    components: { App }
  })
}
